<!DOCTYPE html>
<html lang="zh-CN">
<head>
	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
	<title>{$seo.title?:'页面标题'}</title>
	<meta name="keywords" content="{$seo.keywords?:'关键词'}">
	<meta name="description" content="{$seo.description?:'内容介绍'}">
	<!-- Bootstrap -->
	<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
	<!--[if lt IE 9]>
	<script src="https://cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.min.js"></script>
	<script src="https://cdnjs.cloudflare.com/ajax/libs/respond.js/1.4.2/respond.min.js"></script>
	<![endif]-->
	<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
	<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
	<style>
		body{}
		body img{
		    max-width: 100%;
		}
		a img{
		    max-width: none;
		}
		*{
		    outline: none;
		}
		*:focus{
		    outline:none;
		}
		a:focus{
		    outline:none;
		}
		input:focus{
		    outline:none;
		}
		button:focus{
		    outline:none;
		}
		button:active{
		    outline:none;
		}
	</style>
	{php}\mylib\Hook::listen('home_header');{/php}
	</head>
<body>
	<div class="container">
		<div style="font-size: 32px;font-weight: bolder;margin: 20px 0;">{:config('site_name')}</div>
		{php}
			$_channels = level(\Channel::get());
			function level($channels, $pid=0, $level=0){
				$res = [];
				foreach ($channels as $key => $value) {
					$value['_level'] = $level;
					if ($value['pid'] == $pid) {
						$value['subs'] = level($channels, $value['id'], $level+1);
						$res[] = $value;
					}
				}
				return $res;
			}
		{/php}
		<nav class="navbar navbar-default">
			<div class="navbar-header">
				<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
					<span class="sr-only">Toggle navigation</span>
					<span class="icon-bar"></span>
					<span class="icon-bar"></span>
					<span class="icon-bar"></span>
				</button>
				<a class="navbar-brand" href="{:url('/home/index/index')}">{:config('site_name')}</a>
			</div>

			<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
				<ul class="nav navbar-nav">
					<li class="{if isset($curpos) && $curpos === 'index'}active{/if}"><a href="{:url('/home/index/index')}">首页 <span class="sr-only">(current)</span></a></li>
					{foreach $_channels as $v}
					{if $v['nav']}
						{if $v['subs']}
							<li class="{if isset($curpos) && $v['id'] === $curpos}active{/if}">
								<a href="{:url('/home/content/index', ['id'=>$v['id']])}" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">{$v.title} <span class="caret"></span></a>
								<ul class="dropdown-menu">
									{foreach $v['subs'] as $vo}
										{if $vo['nav']}
										<li><a href="{:url('/home/content/index', ['id'=>$vo['id']])}" target="{$vo.target}">{$vo.title}</a></li>
										{/if}
									{/foreach}
								</ul>
							</li>
						{else}
							<li class="{if $v['id'] == $curpos}active{/if}"><a href="{:url('/home/content/index', ['id'=>$v['id']])}" target="{$v.target}">{$v.title}</a></li>
						{/if}
					{/if}
					{/foreach}
				</ul>
				<form class="navbar-form navbar-right" action="{:url('/home/content/search')}" method="GET">
					<div class="form-group">
						<input type="text" name="q" autocomplete="off" class="form-control" placeholder="Search">
					</div>
					<button type="submit" class="btn btn-default">搜索</button>
				</form>
			</div>
		</nav>
		{php}\mylib\Hook::listen('home_slide');{/php}
		{if isset($pos) && is_array($pos) && $pos}
		<ol class="breadcrumb">
			<li><a href="{:url('/home/index/index')}">首页</a></li>
			{foreach $pos as $v}
			<li><a href="{$v.url}">{$v.title}</a></li>
			{/foreach}
		</ol>
		{/if}